#ifndef _USER_H
#define _USER_H

#define GREEN "\033[0;32;24m"
#define RED  "\033[0;31;24m"
#define YELLOW "\033[0;33;24m"
#define BLUE "\033[0;34;24m"
#define PUEPLE "\033[0;35;24m"
#define NONE   "\033[0m"


struct usernode 
{
	char userId[12];
	char name[9];
	char sex[4];
	char role[8];    //"admin","manager","recept","cleaner"
	char email[20];
	char password[7];
	//int roomid;
	struct usernode *next;	
};
typedef struct usernode User;

/**
 * read out all user information
 * from user.tet to user list.
 *
 *return :
 *		success:return list head
 *		failurre: NULL
 */
User *read_user();

/**
 *save one node user information to user.
 *
 *parameter:
 *			User *r : user information struct pointer
 *return :
 *		success: 0
 *		failure: 1
 */

int write_user(User *r);

/**
 *save all user infomation to user.txt
 *parameter :
 *			User *head,user link head pointer
 *	return :
 *			success : 0 ;
 *			failure : 1 ;
 */

int backup_user(User *head);


/**
 *	free all user information struct
 * parameter :
 *			User *head,user link head pointer
 *
 */

int free_user(User head);

void adminSystem();
int display_user(User *head);
int add_user();
int remove_user();
int write_user_all(User *head);
void showTime(int k);
void srtup_user_password();
void edit_user_information();
void backup_Sysyem();
void backup_User();

void managerSystem();
void receptSystem();
void cleanerSystem();

void change_my_userinf(User *r);
/*
 *change my userinformation
 *
*/

#endif

